<?php

function update_password(){
    $uid=$this->get_user_id();
    if ($uid <=0) return json_res(1,'用户未登录');

    $old_pwd = Request::input('old_password');
    $new_pwd = Request::input('new_password');
    $db=SaleUser::find($uid);
    if (!$db) return json_res(1,'用户不存在');
    if ($db->password != $old_pwd) return json_res(1,'旧密码不正确');

    $db->password=$new_pwd;
    $db->save();
    return json_res(0,'ok');
}



?>
